  
  // todo:
  //   user defined variables
  //   equation
  //   table
  
  string translate_var(string vname) {
    string sret(vname);
    int cid=search_fd(get_domain_name(vname));
    
    if(cid>=0) { 
      // variable belong to a domain
      vname=get_varname(vname);      
      
      if(vname=="size") sret.assign(as_string(fd[cid]->solver->GetDim()));
      
      else if(vname=="nx") {
        int dx,dy,dz;
        fd[cid]->solver->GetDim(dx,dy,dz);
        sret=as_string(dx);
      }

      else if(vname=="ny") {
        int dx,dy,dz;
        fd[cid]->solver->GetDim(dx,dy,dz);
        sret=as_string(dy);
      }

      else if(vname=="nz") {
        int dx,dy,dz;
        fd[cid]->solver->GetDim(dx,dy,dz);
        sret=as_string(dz);
      }
      
      else if(vname=="dim") {
        int dx,dy,dz;
        fd[cid]->solver->GetDim(dx,dy,dz);
        sret=(as_string(dx)+" "+as_string(dy)+" "+as_string(dz));
      }
      
      else if(vname=="step") sret=as_string(fd[cid]->solver->GetStep());
      else if(vname=="timestep") sret=as_string(fd[cid]->solver->GetTimestep());
      else if(vname=="time")
        sret=as_string(fd[cid]->solver->GetStep()*fd[cid]->solver->GetTimestep());
      else if(vname=="spacestep") sret=as_string(fd[cid]->solver->GetSpacestep());
      
      else throw "invalid variable name";
    } else {
      // search in buffer
      cid=search_buffer(get_domain_name(vname));
      if(cid>=0) {
        vname=get_varname(vname);
        
        if(vname=="size") 
          sret.assign(as_string(buffer[cid]->size()));
        
        else if(vname=="nx") sret=as_string(buffer[cid]->nx);
        else if(vname=="ny") sret=as_string(buffer[cid]->ny);
        else if(vname=="nz") sret=as_string(buffer[cid]->nz);
        else if(vname=="dim") 
          sret=as_string(buffer[cid]->nx)+" "+
               as_string(buffer[cid]->ny)+" "+
               as_string(buffer[cid]->nz);
        
        else throw "invalid variable name";
      }
    }  
    return sret;
  }
  